/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.controlcobros.dao;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import mx.itschapala.dsw2.controlcobros.modelo.Pagos;

/**
 *
 * @author Maricela
 */
@Stateless
public class PagosDao extends AbstractDao<Pagos> implements PagosDaoLocal {
    @PersistenceContext(unitName = "ControlDeCobros8A-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public PagosDao() {
        super(Pagos.class);
    }
    @Override
     public boolean findByUser(Pagos payment) {
        Query q = em.createNamedQuery("Pagos.findByUser");
        q.setParameter("idUsuario",payment.getId());
        
        return !q.getResultList().isEmpty();
    }

    
}
